<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="s_act" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="gotoPage(''+vueparams+'')" type='primary' size="mini">保存</el-button>
          <el-button @click="gotoPage(''+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>取消</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 活动明细 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="24">
                <el-form-item label="主题" prop="">
                  {{s_act.activities_theme}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="联系人" prop="">
                  {{s_act.activities_contact}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="安排给" prop="">
                  {{s_act.person_name}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="描述" prop="">
                  {{s_act.activities_description}}
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <el-button @click="gotoPage('/crm/sale/BusOpportunityActAdd?'+vueparams+'')" type='success' size="mini"><i class='fa fa-plus'></i>增加记录</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 记录列表 </span>
          </div>
          <el-table :data="redl">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="gotoPage('/crm/sale/BusOpportunityActDet?CMID2='+scope.row.record_id+''+vueparams+'')">查看明细</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="gotoPage('/crm/sale/BusOpportunityActUp?CMID2='+scope.row.record_id+''+vueparams+'')">修改</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_re('&CMID2='+scope.row.record_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="主题" prop="record_id">
              <template slot-scope="scope">
                <el-link @click="gotoPage('/crm/sale/BusOpportunityActDet?CMID2='+scope.row.record_id+''+vueparams+'')" type='primary'>{{scope.row.record_theme}}</el-link>
              </template>
            </el-table-column>
            <el-table-column label="工作类型" prop="record_worktype">
            </el-table-column>
            <el-table-column label="时长" prop="record_duration">
            </el-table-column>
            <el-table-column label="金额" prop="record_amount">
            </el-table-column>
            <el-table-column label="结果" prop="record_results">
            </el-table-column>
          </el-table>
          <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'活动'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'BusOpportunityActList',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_act: {
          activities_theme: null,
          activities_contact: null,
          person_name: null,
          activities_description: null,
        },
        redl: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "1BF69B6D830144DA817BDEE6290C9AEA",
        name: "商机管理",
        selected: "活动"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/crm/sale/PotentialAdmin/busOpportunityActList?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_re(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/crm/sale/PotentialAdmin/d_re?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
